using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;

namespace Models
{
    /// <summary>
    /// 用户角色关联实体类，用于维护用户和角色之间的多对多关系
    /// </summary>
    public class UserRole
    {
        /// <summary>
        /// 用户角色关联ID，主键
        /// </summary>
        public int UserRoleId { get; set; }

        /// <summary>
        /// 用户ID，外键
        /// </summary>
        public int UserId { get; set; }

        /// <summary>
        /// 角色ID，外键
        /// </summary>
        public int RoleId { get; set; }
        
        /// <summary>
        /// 关联的用户实体，必填
        /// </summary>
        [Required]
        public virtual User User { get; set; } = null!;

        /// <summary>
        /// 关联的角色实体，必填
        /// </summary>
        [Required]
        public virtual Role Role { get; set; } = null!;
    }
} 